package com.example.vp.controller.user;

import com.common.domain.R;
import com.example.vp.service.HistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController("user-history")
@RequestMapping("/history/user")
public class HistoryController {
    @Autowired
    private HistoryService historyService;
    @PostMapping
    public R addHistory(@RequestParam Long videoId){
        historyService.addHistory(videoId);
        return R.ok().msg("添加浏览历史成功");
    }
    @DeleteMapping("/{id}")
    public R delectHistoryById(@PathVariable Long id){
        historyService.delectById(id);
        return R.ok().msg("根据id删除浏览历史成功");
    }
    @DeleteMapping
    public R delectHistory(){
        historyService.delectHistory();
        return R.ok().msg("删除所有浏览历史成功");
    }
}
